<template>
	<view>
		<view class="main">
			<zhaoxin-formList ref="formRef" :formArr="formArr" :formObj.sync="formObj" @rightClick="rightClick"/>
			<view class="rg_bt" @click="submit" :class="validTF?'sub':''">确定</view>
		</view>
	</view>
</template>

<script>
	import zhaoxinFormList from '@/components/zhaoxin-formList/zhaoxin-formList.vue'
	export default {
		data() {
			return {
				validTF: false,
				formArr: [
					{
						el: 'date',
						label: '年月日',
						code: 'date',
						startYear: '2020', //开始年
						endYear: '2031', //结束年
						timeType: 'date',
						errTips: '时间没有选'
					},
					{
						el: 'date',
						label: '年月',
						code: 'yearMonth',
						timeType: 'year-month',
					},
					{
						el: 'date',
						label: '年',
						code: 'year',
						timeType: 'year',
					},
					{
						el: 'date',
						label: '年到秒',
						code: 'datetimeAll',
						timeType: 'datetime-all',
					},
					{
						el: 'date',
						label: '年到分钟',
						code: 'datetime',
						timeType: 'datetime',
					},
					{
						el: 'date',
						label: '时分秒',
						code: 'time',
						startYear: '2020',
						timeType: 'time',
					},
					{
						el: 'date',
						label: '时分',
						code: 'hourMinute',
						startYear: '2020',
						timeType: 'hour-minute',
					},
					{
						el: 'date',
						label: '禁用',
						code: 'disabled',
						disabled: true,
						startYear: '2020',
						timeType: 'hour-minute',
					},
				],
				// 对应数组里的code字段，写了就会赋值进去（用于修改信息），不写也会自动创建
				formObj: {
					invitationCode: '2498489'
				},
				config: {
					pureMode: true
				}
			}
		},
		onLoad() {

		},
		components:{
			zhaoxinFormList
		},
		methods: {
			// 点击事件
			rightClick(val) {
				console.log(val)
			},
			submit() {
				if (this.$refs.formRef.checkForm()) {
					let data = this.$refs.formRef.checkForm()
					// 提交数据
					return
					this.$request({
						method: 'POST',
						url: 'url',
						data,
					}).then(res => {
						console.log(res)
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
